import { ApiProperty } from '@nestjs/swagger'
import { BaseEntity, Column, Entity, Index, PrimaryColumn, UpdateDateColumn } from 'typeorm'

@Entity({ name: 'health_device_attr' })
export class DeviceAttrEntity extends BaseEntity {
  @PrimaryColumn({ nullable: false, length: 36, comment: '设备ID' })
  @ApiProperty({ description: '设备ID' })
  @Index({ unique: true })
  uid: string

  @Column({ nullable: true, length: 50, comment: 'MAC地址' })
  @ApiProperty({ description: 'MAC地址' })
  @Index({ unique: false })
  mac: string

  @Column({ nullable: true, length: 50, comment: '设备名称' })
  @ApiProperty({ description: '设备名称' })
  name: string

  @Column({ nullable: true, comment: 'UUID' })
  @ApiProperty({ description: 'UUID' })
  uuid: string

  @Column({ nullable: true, comment: '版本号' })
  @ApiProperty({ description: '版本号' })
  version: string

  @Column({ nullable: true, comment: '功能' })
  @ApiProperty({ description: '功能' })
  capability: string

  @Column({ name: 'connect_state', nullable: true, comment: '连接状态' })
  @ApiProperty({ description: '连接状态' })
  connectState: number

  @Column({ name: 'wear_status', nullable: true, comment: '佩戴状态' })
  @ApiProperty({ description: '佩戴状态' })
  wearStatus: number

  @Column({ nullable: true, comment: '电池电量' })
  @ApiProperty({ description: '电池电量' })
  battery: number

  @UpdateDateColumn({ name: 'updated_at', comment: '更新时间' })
  @ApiProperty({ description: '更新时间' })
  updatedAt: Date
}
